require('../css/commCss/normalize.css')
require('../css/commCss/reset.css')
require('../css/commCss/property.css')
require('../css/commCss/basic.css')

require('../lib/iconfont/iconfont.css')

const axios=require('axios')

require('../css/introduce.less')

window.addEventListener('DOMContentLoaded',function(){
    let RvideoBack=document.querySelector('#RvideoBack')
    let btn=document.querySelector('#btn')
    let fragments=document.querySelector('#fragments')

    RvideoBack.addEventListener('click',function(){
        history.go(-1)
    })

    btn.addEventListener('click',function(){
        location.href='./hands.html'
    })

    let cid=sessionStorage.getItem('cid')
    axios.get('http://139.9.177.51:8099/sports/courseDetail?id='+cid)
    .then(function(res){
        // console.log(res.data.data);
        let data=res.data.data;
        document.querySelector('#frequency').textContent=data.frequency
        document.querySelector('#instrument').textContent=data.instrument
        document.querySelector('#calorie').textContent=data.calorie
        document.querySelector('#time').textContent=data.time
        if(data.peoplenum){
            document.querySelector('#peoplenum').textContent=data.peoplenum
        }
        document.querySelector('#desc').textContent=data.desc
        document.querySelector('#name').textContent=data.name
        let index='http://139.9.177.51:8099'+data.imgurl
        document.querySelector('#imgurl').style.backgroundImage=`url(${index})`
        document.querySelector('#fragments').src='http://139.9.177.51:8099'+data.fragments[0].videoUrl
        document.querySelector('#iconPlay2').addEventListener('click',function(){
            fragments.controls=true
            fragments.play()
            document.querySelector('#Rvideotip').style.display='none'
        })
        sessionStorage.setItem('fragments',JSON.stringify(data.fragments))
    })
})